package Proxy2.Dynamicproxy;

import java.lang.reflect.Proxy;

/**
 * Created by 0171093 on 2018/2/7.
 */
public class ProxyProgramerFactory {

    public static IProgramer getInstance() {
        IProgramer programer = new ProgramerImpl();//实际执行者
        ProgramerHandler handler = new ProgramerHandler(programer);//管理者
        Object programerObject = Proxy.newProxyInstance(programer.getClass().getClassLoader(), programer.getClass().getInterfaces(), handler);

        return (IProgramer) programerObject;
    }
}
